package cn.xt.bean;

import cn.xt.util.DateConverter;

import java.util.Date;

/**
 * @author ifdestiny
 * @create 2018-11-24 10:03
 */

public class HouseCondition {
    private String codeId;
    private String cityName;
    private String startDate;
    private String endDate;
    private String houseType;
    private String lease;
    private Integer startPrice;
    private Integer endPrice;
    private String sort;

    public String getCodeId() {
        return codeId;
    }

    public void setCodeId(String codeId) {
        if(codeId.length()==6){
            this.codeId = codeId.substring(0,4);
        }else{
            this.codeId = codeId;
        }
    }
    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getStartDate() {
        if(startDate==null || "".equals(startDate) ){
           startDate= DateConverter.convertToString(new Date());
        }
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        if(endDate==null || "".equals(endDate) ){
            Date date=new Date();
            date.setTime(date.getTime()+(1000*60*60*24));
            endDate= DateConverter.convertToString(date);
        }
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getHouseType() {
        return houseType;
    }

    public void setHouseType(String houseType) {
        this.houseType = houseType;
    }

    public String getLease() {
        return lease;
    }

    public void setLease(String lease) {
        this.lease = lease;
    }

    public Integer getStartPrice() {
        return startPrice;
    }

    public void setStartPrice(Integer startPrice) {
        this.startPrice = startPrice;
    }

    public Integer getEndPrice() {
        return endPrice;
    }

    public void setEndPrice(Integer endPrice) {
        this.endPrice = endPrice;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    @Override
    public String toString() {
        return "HouseCondition{" +
                "codeId='" + codeId + '\'' +
                ", cityName='" + cityName + '\'' +
                ", startDate='" + startDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", houseType=" + houseType +
                ", lease=" + lease +
                ", startPrice=" + startPrice +
                ", endPrice=" + endPrice +
                ", sort='" + sort + '\'' +
                '}';
    }
}
